home *** CD-ROM | disk | FTP | other *** search
- package com.supercede.forms;
-
- import java.applet.Applet;
- import java.awt.AWTEvent;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.awt.MenuBar;
- import java.awt.Point;
- import java.awt.event.WindowEvent;
- import java.io.IOException;
- import java.io.InvalidObjectException;
- import java.io.ObjectInputStream;
- import java.io.ObjectInputValidation;
- import java.io.Serializable;
- import java.util.Vector;
-
- public class SuperCedeFrame extends Frame implements SuperCedeDesignContainer, Serializable, ObjectInputValidation {
- SuperCedeRuntimeInfo runtimeInfo = new SuperCedeRuntimeInfo();
- SuperCedeDesignInfo designInfo = new SuperCedeDesignInfo();
- transient boolean designMode = false;
- transient DesignModeListener formListener = null;
- transient Vector scContainerListeners = null;
- boolean shadowEnabled = super.isEnabled();
- Point shadowLocation = new Point(0, 0);
- private static final long serialVersionUID = 1013082004010516612L;
- private static final int _version = 1;
- private int version = 1;
-
- public final void initializeThis(Vector var1) throws IOException, ClassNotFoundException, ClassCastException, SuperCedeInvalidStateException {
- this.designInfo = null;
- this.runtimeInfo = null;
- SuperCedeHelper.runTimeConstructor(this, var1);
- ((Component)this).setLocation(this.shadowLocation);
- ((Component)this).enableEvents(64L);
- this.validateObject();
- }
-
- public Component[] getContainedComponents() {
- return ((Container)this).getComponents();
- }
-
- public void initializeFrom(SuperCedeContainer var1) throws ClassCastException, SuperCedeInvalidStateException {
- try {
- this.setDesignMode(((SuperCedeDesignContainer)var1).isDesignMode());
- this.setFormListener(((SuperCedeDesignContainer)var1).getFormListener());
- this.runtimeInfo = var1.getRuntimeInfo();
- this.designInfo = ((SuperCedeDesignContainer)var1).getDesignInfo();
- SuperCedeHelper.convertContainer((Container)var1, this);
- if (!this.isDesignMode()) {
- this.runtimeInfo = null;
- this.designInfo = null;
- }
- } catch (ClassCastException var3) {
- throw var3;
- }
- }
-
- public SuperCedeDesignInfo getDesignInfo() {
- return this.designInfo;
- }
-
- public SuperCedeRuntimeInfo getRuntimeInfo() {
- return this.runtimeInfo;
- }
-
- public void addComponent(Component var1, Object var2) {
- this.addComponent(var1, var2, -1);
- }
-
- public void addComponent(Component var1, Object var2, int var3) {
- this.add(var1, var2, var3);
- this.runtimeInfo.addLayoutConstraints(var1, var2);
- }
-
- public void add(Component var1, Object var2, int var3) {
- super.add(var1, var2, var3);
- if (((Component)this).isVisible() && var1 instanceof Applet) {
- ((Applet)var1).start();
- }
-
- }
-
- public void removeComponent(int var1) {
- this.removeComponent(((Container)this).getComponent(var1));
- }
-
- public void removeComponent(Component var1) {
- this.runtimeInfo.removeLayoutConstraints(var1);
- this.remove(var1);
- }
-
- public void remove(Component var1) {
- if (((Component)this).isVisible() && var1 instanceof Applet) {
- ((Applet)var1).stop();
- }
-
- super.remove(var1);
- }
-
- public boolean isEnabled() {
- return this.shadowEnabled;
- }
-
- public void setEnabled(boolean var1) {
- this.shadowEnabled = var1;
- if (!this.isDesignMode()) {
- super.setEnabled(var1);
- }
-
- }
-
- public void paint(Graphics var1) {
- if (this.formListener != null) {
- this.formListener.paint(var1);
- }
-
- super.paint(var1);
- }
-
- public void addNotify() {
- super.addNotify();
- if (this.formListener != null) {
- this.formListener.addedPeer();
- }
-
- }
-
- public void removeNotify() {
- if (this.formListener != null) {
- this.formListener.removingPeer();
- }
-
- super.removeNotify();
- }
-
- public void setMenuBar(MenuBar var1) {
- MenuBar var2 = ((Frame)this).getMenuBar();
- if (var2 != var1) {
- if (var2 == null || var1 == null) {
- Insets var3 = ((Container)this).getInsets();
- super.setMenuBar(var1);
- Insets var4 = ((Container)this).getInsets();
- int var5 = var4.top - var3.top;
- Dimension var6 = ((Component)this).getSize();
- var6.height += var5;
- ((Component)this).setSize(var6);
- int var7 = ((Container)this).getComponentCount();
-
- for(int var8 = 0; var8 < var7; ++var8) {
- try {
- Component var9 = ((Container)this).getComponent(var8);
- Point var10 = var9.getLocation();
- var10.y += var5;
- var9.setLocation(var10);
- } catch (ArrayIndexOutOfBoundsException var11) {
- }
- }
-
- }
- }
- }
-
- public Object getLayoutConstraints(Component var1) {
- return this.runtimeInfo.getLayoutConstraints(var1);
- }
-
- public Object getLayoutConstraints(int var1) {
- return this.getLayoutConstraints(((Container)this).getComponent(var1));
- }
-
- public void setDesignMode(boolean var1) {
- this.designMode = var1;
- }
-
- public boolean isDesignMode() {
- return this.designMode;
- }
-
- public void setFormListener(DesignModeListener var1) {
- this.formListener = var1;
- }
-
- public DesignModeListener getFormListener() {
- return this.formListener;
- }
-
- public void setVisible(boolean var1) {
- if (!var1) {
- SuperCedeHelper.setAppletVisibility(this, this.isDesignMode(), false);
- }
-
- super.setVisible(var1);
- if (var1) {
- SuperCedeHelper.setAppletVisibility(this, this.isDesignMode(), true);
- }
-
- }
-
- protected void processWindowEvent(WindowEvent var1) {
- if (((AWTEvent)var1).getID() == 201 && this.scContainerListeners != null) {
- SuperCedeContainerEvent var3 = new SuperCedeContainerEvent(this, 4434);
- synchronized(this){}
-
- Vector var2;
- try {
- var2 = (Vector)this.scContainerListeners.clone();
- } catch (Throwable var6) {
- throw var6;
- }
-
- for(int var4 = 0; var4 < var2.size(); ++var4) {
- ((SuperCedeContainerListener)var2.elementAt(var4)).containerShutdown(var3);
- }
- }
-
- super.processWindowEvent(var1);
- }
-
- public void addSuperCedeContainerListener(SuperCedeContainerListener var1) {
- synchronized(this){}
-
- try {
- if (this.scContainerListeners == null) {
- this.scContainerListeners = new Vector();
- }
-
- this.scContainerListeners.addElement(var1);
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void removeSuperCedeContainerListener(SuperCedeContainerListener var1) {
- synchronized(this){}
-
- try {
- this.scContainerListeners.removeElement(var1);
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
- var1.defaultReadObject();
-
- try {
- SuperCedeHelper.doDeserializationProcessing(this);
- } catch (SuperCedeInvalidStateException var2) {
- }
- }
-
- public void validateObject() throws InvalidObjectException {
- }
- }
-